package cn.chenxiejia;

/***
 * @program: maven
 * @ClassName: String1
 * @Description:
 * @Author: chenxiejia
 * @Date: 2022/1/15 9:08
 * @version : V1.0
 */
public class String1 {
    public static void main(String[] args) {
        String str = "ljavadfjsdfhgjjfsjavajfdsj";
        System.out.println(str.indexOf("java"));//1
        System.out.println(str.indexOf("java", 10));//17
        System.out.println(str.lastIndexOf("java"));
        System.out.println(str.startsWith("java"));//false
        System.out.println(str.endsWith("java"));//false

        System.out.println("  Hello world   ".trim());
        String ss = "java,php,c,pyhon,html";
        String[] s1 = ss.split(",");
        for (String s : s1) {
            System.out.println(s);
        }
        //截取第一个java开始到最后一个java之前的字符串
        String s2 = str.substring(str.indexOf("java"), str.lastIndexOf("java"));
        System.out.println(s2);
        System.out.println(str.contains("s"));

    }
}
